Integrate [DurableExecution] with the Annotations source generator#2410
Conversation
ab1af0b to
a921009
Compare
a921009 to
925f3b5
Compare
45da58d to
35c966c
Compare
| <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
| <!-- src\Function is a separate, self-contained project. Exclude its subtree so this project's | ||
| default globs don't pick up its sources or generated obj\AssemblyInfo (which causes CS0579). --> | ||
| <DefaultItemExcludes>$(DefaultItemExcludes);src\**</DefaultItemExcludes> |
There was a problem hiding this comment.
was running into build issue so fixed this too
| // the exact entry point the hand-written and executable test functions call, so the | ||
| // checkpoint/replay/history behavior is identical. | ||
| [LambdaFunction] | ||
| [DurableExecution] |
There was a problem hiding this comment.
i manually deployed this too and also played around with updating the attributes and checking that they reflected in the template too
Add a [DurableExecution] attribute (in Amazon.Lambda.Annotations) and source generator support so a method annotated with [LambdaFunction] + [DurableExecution] generates: - a typed-envelope handler wrapper delegating to DurableFunction.WrapAsync<TInput[,TOutput]> - a DurableConfig block on the function resource in the generated CFN/SAM template - lambda:CheckpointDurableExecution / lambda:GetDurableExecutionState IAM permissions (per-function inline policy; skipped when an explicit Role is set) Validation gates (AWSLambda0140-0143) require durable functions to be executable (OutputKind), Zip-packaged, and have the (TInput, IDurableContext) -> Task/Task<TOutput> signature; combining with another event attribute reuses the existing AWSLambda0102. The generated WrapAsync call emits explicit generic type arguments because method-group arguments cannot be inferred for the Func<,,> parameter (CS0411). fiox build annotations updates updates update docs pr comments
183524b to
5a5447e
Compare
| // Assembly::Type::Method), which LambdaFunctionModel.Handler already derives from IsExecutable. So no | ||
| // OutputKind gate is needed here. | ||
|
|
||
| // Image packaging strips Handler/Runtime from the function resource, which the durable |
There was a problem hiding this comment.
I don't understand this comment and why image functions don't work. Especially since that is how we tell customers to test the preview. Maybe a quick sync up between us to help me understand what is causing the issue.
There was a problem hiding this comment.
Might be AI slop. I also asked Claude about this, I think he mentioned the other annotations have the same limitation. I'll double check
There was a problem hiding this comment.
fixed in 3bee3f5. claude incorrectly assumed some things
philasmar
left a comment
There was a problem hiding this comment.
- Resource:
"*"on the IAM policy — The inline checkpoint policy grantslambda:CheckpointDurableExecutionandlambda:GetDurableExecutionStateon"*". The comment says this is a known preview limitation pending a scopable ARN format. This is fine for preview, but should be tracked as a follow-up to scope down once the service supports it. Consider adding a TODO comment or linking an issue so this doesn't get forgotten post-GA. - Diagnostic ID gap — The
AnalyzerReleases.Unshipped.mdlistsAWSLambda0142-0144, but the design doc mentionsAWSLambda0141was intended for a Zip-packaging validation. Either allocate 0141 for the Zip check (the validation is mentioned in the PR description) or document why it was skipped to avoid confusion if someone later tries to use that ID. IsDurableCheckpointStatementuses string serialization — The helperIsDurableCheckpointStatementserializes the policy object to JSON and checks for a substring match on the Sid. This works but is fragile if the Sid string ever appears in a comment or different context. A more robust approach would be to try casting the object toDictionary<string, object>and checking the structure directly. Low risk in practice but worth noting.- Design doc checked in —
docs/design/annotations-integration-plan.mdis a superseded planning artifact with outdated information (e.g., references to
AWSLambda0140that was never allocated,"executable-only"gating that was removed). Consider removing it or moving it to a wiki/issue to avoid confusion for future contributors reading the source tree.
i dont think these are actual issues |
fixed in latest commit |
Add a [DurableExecution] attribute (in Amazon.Lambda.Annotations) and source generator support so a method annotated with [LambdaFunction] + [DurableExecution] generates:
Issue #, if available:
#2418
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.